package com.liao.ticket.controller;

import com.liao.ticket.service.OrderService;
import com.liao.ticket.vo.Result;
import com.liao.ticket.vo.params.OrderParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户验证通过才可进行操作
 * 接口测试成功
 * 1.0.2
 * 10.15 1:51
 */
@RestController
@RequestMapping("ticket")
public class OrderSaleController {
    @Autowired
    private OrderService orderService;

    // 用户 确定下单 -> 添加 订单
    @PostMapping("certain")
    public Result certainOrder(@RequestBody OrderParams orderParams, @RequestHeader String token) {
        Result result = orderService.certainOrder(orderParams,token);
        return result;
    }

    // 用户 取消订单 -> 修改 订单状态 20
    @GetMapping("cancel/{id}")
    public Result cancelOrder(@PathVariable Long id,@RequestHeader String token){
        Result result = orderService.cancelOrder(id,token);
        return result;
    }

    // 修改 手机号
    @PostMapping("phone")
    public Result updatePhone(@RequestBody OrderParams orderParams) {
        Result result = orderService.updatePhoneById(orderParams);
        return result;
    }
}
